package cn.wolfcode.car.advice;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

@ControllerAdvice
public class ExceptionControllerAdvice {
 @ExceptionHandler(RuntimeException.class)
    public String handlerException(RuntimeException e, Model model){
     model.addAttribute("errorMsg",e.getMessage());
     return "errorView";
 }
}
